// pages/get/get.js
const db = wx.cloud.database()
const memo = db.collection('memocyou')
const _ = db.command
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    count:'count'
  },
  yu_new(){
    memo.orderBy('date', 'desc').limit(10).get().then(res=>{
      console.log("2222")
      this.setData({
        list:res.data.map(v=>({...v,date:(new Date(v.date).toLocaleString())})),
      })
    })
  },
  yu_old(){
    memo.orderBy('date', 'asc').limit(10).get().then(res=>{
      console.log("2222")
      this.setData({
        list:res.data.map(v=>({...v,date:(new Date(v.date).toLocaleString())})),
      })
    })
  },
  yu_count(){
    memo.count().then(res=>{
      console.log(res);
      this.setData({count:res.total});
    })
  }
})